#Week 3 _ Lists

import math

#################################################
# Helper functions
#################################################

def almostEqual(d1, d2, epsilon=10**-7):
    # note: use math.isclose() outside 15-112 with Python version 3.5 or later
    return (abs(d2 - d1) < epsilon)

#1.
def alternatingSum(a) :
    return 42

#2.
def median(a):
    return 42

#3.
def isPalindromicList(a):
    return 42

#4.
def reverse(a):
    return 42

#5.
def vectorSum(a, b):
    return 42

#6.
def reverse(a):
    return 42

#3.
def isSorted(a):
    return 42

#4.
def dotProduct(a,b):
    return 42

#5.
def moveToBack(a,b):
    return 42

#6.
def binaryListToDecimal(a):
    return 42

#7.
def smallestDifference(a):
    return 42

#8.
def repeatingPattern(a):
    return 42

#9
def mostAnagrams(wordList) :
    return 42

def map(f,a):
    return 42

def firstNEvenFibonacciNumbers(n):
    return 42

def mostCommonName(a):
    return 42

def nearestWords(wordList, word):
    return 42

def bowlingScore(pinsPerThrowList):
    return 42

def evalPolynomial(coeffs, x):
    return 42

def areaOfPolygon(L):
    return 42

def testAreaOfPolygon():
    print("Testing areaOfPolygon()...", end="")
    assert(almostEqual(areaOfPolygon([(4,10), (9,7), (11,2), (2,2)]), 45.5))
    assert(almostEqual(areaOfPolygon([(9,7), (11,2), (2,2), (4, 10)]), 45.5))
    assert(almostEqual(areaOfPolygon([(0, 0), (0.5,1), (1,0)]), 0.5))
    assert(almostEqual(areaOfPolygon([(0, 10), (0.5,11), (1,10)]), 0.5))
    assert(almostEqual(areaOfPolygon([(-0.5, 10), (0,-11), (0.5,10)]), 10.5))
    print("Passed!")

def testAll():
    testAreaOfPolygon()

def main():
    testAll()

if __name__ == '__main__':
    main()